object ListProcessor {  
      
  def addOne(numbers: List[Int]): List[Int] =  
    numbers.map(_ + 1)  
  
  def filterEven(numbers: List[Int]): List[Int] =  
    numbers.filter(_ % 2 == 0)  
  
  def mapReduce[A, B](numbers: List[A], mapFunc: A => B, reduceFunc: (B, B) => B): B =  
    numbers  
      .map(mapFunc)  
      .reduce(reduceFunc)  
   
  def main(args: Array[String]): Unit = {  
    val numbers = List(1, 2, 3, 4, 5)  
      
    println(s"addOne result: ${addOne(numbers)}")  
    println(s"filterEven result: ${filterEven(numbers)}")  
      
    val mapFunc = (x: Int) => x + 1  
    val reduceFunc = (x: Int, y: Int) => x + y  
    println(s"mapReduce result: ${mapReduce(numbers, mapFunc, reduceFunc)}")  
  }  
}
